/*
题目链接：https://leetcode.cn/problems/jump-game/description/
	刘沛民	2024-12-3
*/

class Solution {
public:
    bool canJump(vector<int>& nums) {
        if(nums.size()==1) return true;
        int farest = 0;
        for(int i=0;i<=farest;i++){
            farest = max(farest,i+nums[i]);
            if(farest>=nums.size()-1) return true;
        }
        return false;
    }
};
